package pojo;



import java.util.Objects;

public class CarType {
    private String id;
    private String name;

    public CarType() {
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public CarType(String id, String name) {
        this.id = id;
        this.name = name;
    }

    public static CarType valueOf(String str){
        CarType carType = new CarType();
        try {
            String strs[] = new String[2];
            strs = str.split("/");
            carType.id = strs[0];
            carType.name = strs[1];

            System.out.println(carType);

        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }finally {
            return carType;
        }
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CarType carType = (CarType) o;
        return Objects.equals(id, carType.id) &&
                Objects.equals(name, carType.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name);
    }

    @Override
    public String toString() {
        return "CarType{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                '}';
    }
}
